<?php

/**
 * \file
 * Classe `varchar`.
 */

namespace pilar\Entities\Fields /* \cond */ ; /* \endcond */
{

/**
 * Champ texte de type `VARCHAR` en base de données.
 *
 * \since 29/07/2008
 * \author Matthieu OVIEDO <matthieu.oviedo@gmail.com>
 */
class Varchar extends Field {

protected function loadDefaultParams() {
 parent::loadDefaultParams();

 $this->params->define(array(
  'maxLength' => 255,
  'caseSensitive' => false
 ));
}


public function sqlProperties() {
 return
  ($this->param('caseSensitive') ? 'VARBINARY' : 'VARCHAR').
  '('.$this->param('maxLength').')'.
  ' NOT NULL'.
  ' DEFAULT \''.$this->param('defaultValue').'\'';
}


} // Class.

} // Namespace.

?>
